<template>
<div class="groups-info-list views-container">
    <div class="wlm-table">
        <div class="wlm-table-header" style="margin-bottom:20px;">
            <div class="dashboard-header">
                <el-row :gutter="8">
                    <el-col :span="8">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title"><span>开团数</span>
                                <el-popover placement="top-start"  trigger="hover">
                                    <div style="font-size:12px">发起开团的用户数</div>
                                    <el-button style="color:#333333" type="text" slot="reference"><svg-icon icon-class="wenhao" style="font-size:20px"/></el-button>
                                </el-popover>
                            </div>
                            <div class="item-num">
                                <span>{{categoryData.openNumber||'0'}}</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title"><span>参团数</span>
                                <el-popover placement="top-start"  trigger="hover">
                                    <div style="font-size:12px">已经支付订单的用户数</div>
                                    <el-button style="color:#333333" type="text" slot="reference"><svg-icon icon-class="wenhao" style="font-size:20px"/></el-button>
                                </el-popover>
                            </div>
                            <div class="item-num">
                                <span>{{categoryData.joinNumber||'0'}}</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c ">
                            <div class="item-title"><span>成团数</span>
                                <el-popover placement="top-start"  trigger="hover">
                                    <div style="font-size:12px">已经成团的团数</div>
                                    <el-button style="color:#333333" type="text" slot="reference"><svg-icon icon-class="wenhao" style="font-size:20px"/></el-button>
                                </el-popover>
                            </div>
                            <div class="item-num">
                                <span>{{categoryData.completeNumber||'0'}}</span>
                            </div>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </div>
        <div class="wlm-table-header">
            <el-form :model="tableFormatData.userTable.files" size="small" label-width="85px" class="retail-form" label-position="right">
                <el-form-item label="" class="filter">
                    <el-form-item label="拼团编号：">
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.userTable.files.group_no" placeholder="请输入拼团编号" style="width:160px;"></el-input>
                    </el-form-item>
                    <el-form-item label="拼团状态：">
                         <el-select v-model="tableFormatData.userTable.files.status" placeholder="请选择">
                            <el-option v-for="item in [{lable:'全部',value:''},{lable:'拼团中',value:'0'},{lable:'拼团成功',value:'1'},{lable:'拼团失败',value:'2'},{lable:'模拟成团',value:'3'}]" :key="item.value" :label="item.lable" :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="wlm-table-content">
            <!-- <p style="font-weight: 600;padding-bottom: 14px;">入账商品</p> -->
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <!-- <el-table-column type="selection" width="55">
                </el-table-column> -->
                <el-table-column prop="name" label="拼团编号" >
                    <template slot-scope="scope">
                        <span>{{scope.row.group_no}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="商品"  min-width="130">
                    <template slot-scope="scope">
                        <div class="wlm-table-logos">
                            <img class="logo" :src="scope.row.image.file_path">
                            <div class="inner-text">
                                <p style="white-space: nowrap;">{{scope.row.goods_name}}</p>
                                <span>￥{{scope.row.groups_price}}</span>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="拼团进度"  min-width="40">
                    <template slot-scope="scope">
                        <span>{{scope.row.lastnumber}}/{{scope.row.fullnumber}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="开团时间" >
                    <template slot-scope="scope">
                        <span v-if="scope.row.createtime">{{Number(scope.row.createtime)*1000 | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
                        <span v-if="!scope.row.createtime">-</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="成团时间" >
                    <template slot-scope="scope">
                        <span v-if="scope.row.finishtime">{{Number(scope.row.finishtime)*1000 | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
                        <span v-if="!scope.row.finishtime">-</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="拼团状态"  min-width="40">
                    <template slot-scope="scope">
                        <span v-if="scope.row.status=='0'">拼团中</span>
                        <span v-if="scope.row.status=='1'">拼团成功</span>
                        <span v-if="scope.row.status=='2'">拼团失败</span>
                        <span v-if="scope.row.status=='3'">模拟成团</span>
                    </template>
                </el-table-column>
                 <el-table-column label="操作" >
                    <template slot-scope="scope">
                        <div class="operation-group">
                            <el-popover placement="bottom" trigger="click" v-if="scope.row.status!='3'">
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersVerificationManagement', query :{groups_group_id:scope.row.id,order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">核销订单</span>
                                </router-link>
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersComeStoreManagement', query :{groups_group_id:scope.row.id,order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">自提订单</span>
                                </router-link>
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersExpressManagement', query :{groups_group_id:scope.row.id,order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">快递订单</span>
                                </router-link>
                                <el-button type="text" class="wlm-text" slot="reference">拼团订单</el-button>
                            </el-popover>
                            <el-popover placement="bottom" trigger="click" v-if="scope.row.status=='3'">
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersVerificationManagement', query :{groups_group_id:scope.row.id,auto_groups:'1',order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">核销订单</span>
                                </router-link>
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersComeStoreManagement', query :{groups_group_id:scope.row.id,auto_groups:'1',order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">自提订单</span>
                                </router-link>
                                <router-link tag="p" style="text-align:center;padding: 3px 0;" :to="{path:'/orders/ordersExpressManagement', query :{groups_group_id:scope.row.id,auto_groups:'1',order_type:'2',groups_id:scope.row.groups_id}}">
                                    <span class="pointer">快递订单</span>
                                </router-link>
                                <el-button type="text" class="wlm-text" slot="reference">拼团订单</el-button>
                            </el-popover>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-e flex-align-c">
                <!-- <el-row class="pagination-btns">
                    <el-checkbox class="check-all" true-label="1" false-label="0" v-model="tableFormatData.userTable.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <el-button class="right-8" :disabled="isGroup" size="mini" @click="delTableList">删除</el-button>
                </el-row> -->
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.userTable.pagination.page" :page-sizes="tableFormatData.userTable.pagination.pagesizes" :page-size.sync="tableFormatData.userTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.userTable.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  getGroupsNumber,
  getGroupsShow
} from '@/api/application'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'GroupsInfoList',
  components: {
  },
  created() {
    getGroupsShow({ groups_id: this.$route.query.groups_id }).then((response) => {
      const {
        data: {
          data: msgData = []
        }
      } = response
      this.categoryData = msgData
    })
  },
  data() {
    return {
      categoryData: {},
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          api: {
            getList: getGroupsNumber
          },
          tableData: [],
          files: {
            group_no: '',
            status: '',
            ids: [],
            // redirect: 'groups_id',
            checkall: '0',
            Recycle: '1'
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  },
  methods: {
  }
}
</script>
